import java.util.ArrayList;

public class Mailbox {
    private int num = 0;
    private ArrayList<Message> box = new ArrayList<>();
    Mailbox(){

    }
    public void addMessage(Message m){
        box.add(m);
        num++;
    }
    public String getMessage(int i){
        if(i<=num)
            return this.box.get(i-1).toString();
        else
        {
            System.out.println("There are no files in this position");
            return null;
        }
    }
    public boolean removeMessage(int i){
        if(i>num)
        {
            System.out.println("There are no files in this position");
            return false;
        }
        else {
            this.box.remove(i);
            --num;
        }
        return true;
    }
}
